<template>
  <div class="wrapper wrapper-content">
	<div class="oauth-container">
		<div class="flow-title">欢迎使用医保影像云一体化质控与运维管理系统</div>
	</div>
</div>
</template>

<script setup name="Index">
import axios from 'axios'
import { onMounted } from 'vue'
import { useRoute } from 'vue-router'
import { getToken } from '@/utils/auth'
import { saveAs } from 'file-saver'
const version = ref('3.9.0')
const baseURL = import.meta.env.VITE_APP_BASE_API
const route = useRoute()
	function downloadDoc() {
		var url =  baseURL+'/common/downloadDoc';
     axios({
      method: 'get',
      url: url,
      responseType: 'blob',
      headers: { 'Authorization': 'Bearer ' + getToken() }
    }).then((res) => {
      debugger
      const contentDisposition = res.headers['content-disposition'];
    if (contentDisposition) {
      var filename
      const match = contentDisposition.match(/filename\*?=['"]?(?:UTF-\d['"]*)?([^;\n]*)['"]?/i);
      if (match && match[1]) {
        filename = decodeURIComponent(match[1]);
      }
    }

    // 确保文件名以 .docx 结尾
    if (!filename.endsWith('.docx')) {
      filename += '.docx';
    }

    // 使用 file-saver 保存文件
    saveAs(new Blob([res.data], { type: res.headers['content-type'] }), filename);
    })
	}

onMounted(() => {
  const token = route.query.token
  if (token) {
    localStorage.setItem('token', token) // 存储token
  }
})

</script>

<style scoped lang="scss">
	.oauth-container {
			padding: 20px;
			background: #fff;
			border-radius: 5px;
			box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
		}
		.flow-title {
			text-align: center;
			font-size: 24px;
			margin-bottom: 30px;
			padding-bottom: 15px;
			border-bottom: 1px solid #eee;
		}
		.flow-step {
			margin-bottom: 30px;
			padding: 20px;
			border: 1px solid #e6e6e6;
			border-radius: 4px;
			position: relative;
		}
		.step-number {
			position: absolute;
			left: -15px;
			top: -15px;
			width: 40px;
			height: 40px;
			line-height: 40px;
			text-align: center;
			background: #1890ff;
			color: #fff;
			border-radius: 50%;
			font-weight: bold;
		}
		.step-title {
			font-size: 18px;
			font-weight: bold;
			margin-bottom: 10px;
			color: #333;
		}
		.step-desc {
			color: #666;
			margin-bottom: 15px;
		}
		.step-img {
			width: 100%;
			max-width: 800px;
			border: 1px solid #eee;
			border-radius: 4px;
		}
		.full-flow {
			margin-top: 40px;
			text-align: center;
		}
		.full-flow-title {
			font-size: 20px;
			margin-bottom: 20px;
		}
		.download-btn {
			text-align: center;
			margin-top: 30px;
		}
</style>

